package springcloudDemo.service;

import springcloudDemo.model.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class ComplexService {

    @RequestMapping(value = "/hello1",method = RequestMethod.GET)
    public String hello(@RequestParam String name){
        return "hello "+ name;
    }

    @RequestMapping(value = "/hello2",method = RequestMethod.GET)
    public User hello(@RequestHeader String name,@RequestHeader Integer age){
        User result = new User();
        result.setAge(age);
        result.setName(name);
        return result;
    }

    @RequestMapping(value = "/hello3",method = RequestMethod.POST)
    public String hello(@RequestBody User user){
        return "Hello "+ user.getName() + ", "+user.getAge();
    }

}
